#include<stdio.h>
#include<stdlib.h>
#include<string.h>

struct bucket {
char file_path[100];
struct bucket *next;
};

struct Hash{
char key;
struct bucket *b;
}h[26];

char hash_key(char file_name[])
{
char key;
key=tolower(file_name[0]);
return key;
}

void hashing(char file_name[],char key)
{
 int index=key-97;
 struct bucket *temp=(struct bucket *)malloc(sizeof(struct bucket));
 strcpy(temp->file_path,file_name);
 temp->next=NULL;
 struct bucket *t_head=h[index].b;
 if(t_head==NULL)
 {
   h[index].b=temp;
 } 
 else
 {
	temp->next=t_head;
	h[index].b=temp;
 }
}

void iterate(int key,struct bucket *b)
{
struct bucket *t=b;
printf("\n%c",key);
while(t!=NULL)
 {
	printf("-->%s ",t->file_path);
	t=t->next;
 }
}

void main()
{
char file_name[30];
int i;
char code='a';
for(i=0;i<26;i++,code++)
 {
 h[i].key=code;
 h[i].b=NULL;
 }
printf("\n Enter three file name");
for(i=0;i<3;i++)
{
scanf("%s",file_name);
hashing(file_name,hash_key(file_name));
}
for(i=0;i<26;i++)
  iterate(h[i].key,h[i].b);
}
